package com.dtsheep.elasticsearch.test;

import com.dtsheep.elasticsearch.po.User;

import java.util.*;
import java.util.stream.Collectors;

/**
 * MapDemo
 *
 * <p>
 * </p>
 *
 * @author chuanbai
 * @date 2024/7/11
 */
public class MapDemo {

    public static void main(String[] args) {
        Map<String, User> hashMap = new HashMap<>();
        System.out.println(hashMap);
        if (hashMap.containsKey("1")){
            System.out.println("有");
        }else {
            System.out.println("么有");
        }

        User user1 = new User();
        user1.setName("1");
        user1.setSex("男");
        User user2 = new User();
        user2.setName("1");
        user2.setSex("女");
        List<User> list = new ArrayList<>();
        list.add(user1);
        list.add(user2);
        Map<String, List<User>> userMap = list.stream().collect(Collectors.groupingBy(User::getName));
        System.out.println(userMap);

        int i1= 1;
        Integer i2 = new Integer(1);
        System.out.println(Objects.equals(i1,i2));
        Double d1= 0.000D;
        Double d2 = 0D;
        System.out.println(Objects.equals(d1, d2));

        ArrayList<Object> list1 = new ArrayList<>();
        System.out.println(list1.size());
    }
}
